<%
QString lang = httpRequest().cookie("lang");
QVariant tid = tId();
QVariantMap qMapOut;
qMapOut.insert("tid",tid);
%>
<!-- searchFrom -->
<fieldset id="searchFieldsetRoleApp<%== tid %>" class="hideFieldset"> <!--    default hide-->
<legend><label>
<input type="checkbox" onclick="toggleSearch(this, 'searchFieldsetRoleApp<%== tid %>')" hidefocus=""/><%== UI("Search Criteria") %>
</label></legend>
<div class="fieldset-body">
    <%== renderPartial("HrRole/formSearchRoleApp",qMapOut) %>
 </div>
</fieldset>
<!-- toolBar -->
 <div class="mini-toolbar" style="border:0px">
        <a class="mini-button" onclick="doSearch('searchFormRoleApp<%== tid %>','gridRoleApp<%== tid %>')"><%== UI("Search") %></a>
        <a class="mini-button" onclick="showRecord('gridRoleApp<%== tid %>','<%== UI("RoleApp") %>',650,500,'/PartialService/formRoleApp?action=show',['roleId'])" tooltip="" ><%== UI("Show Details") %></a>
    <% if (accessAllow("HrRole","createRoleApp")){ %>
        <a class="mini-button" onclick="createRecord('<%== UI("RoleApp") %>',650,500,'/PartialService/formRoleApp?action=create')" tooltip="<%== UI("TP_HRROLE_CREATE_ROLEAPP") %>" ><%== UI("Create") %></a>
    <% } %>
    <% if (accessAllow("HrRole","editRoleApp")){ %>
        <a class="mini-button" onclick="editRecord('gridRoleApp<%== tid %>','<%== UI("RoleApp") %>',650,500,'/PartialService/formRoleApp?action=edit',['roleId'])" tooltip="<%== UI("TP_HRROLE_EDIT_ROLEAPP") %>" ><%== UI("Edit") %></a>
    <% } %>
    <% if (accessAllow("HrRole","deleteRoleApp")){ %>
        <a class="mini-button" onclick="deleteRecord('gridRoleApp<%== tid %>','/SystemUIsetting/deleteRoleApp',['roleId'],'<%== csrfVal() %>')" tooltip="<%== UI("TP_HRROLE_DELETE_ROLEAPP") %>" ><%== UI("Delete") %></a>
    <% } %>
 </div>
<!-- grid -->
<div class="mini-fit">
<div id="gridRoleApp<%== tid %>" name="gridRoleApp" class="mini-datagrid" url="/DataService/Search/RoleApp?searchMode=page" allowSortColumn="false" 
   style="height:100%" showEmptyText="true" multiSelect="true" onpreload="onpreload" >
  <div property="columns">
   <div type="indexcolumn" width="25"></div>
   <div type="checkcolumn" width="25"></div>
   <div field="roleId" visible="false"><%== UI("ROLEID") %></div>
   <div field="roleCd" allowsort="true"><%== UI("ROLECD") %></div>
   <div field="roleNameZh" allowsort="true"><%== UI("ROLENAMEZH") %></div>
   <div field="roleNameEn" allowsort="true" width="100%"><%== UI("ROLENAMEEN") %></div>
  </div>
</div>
</div>
<script type="text/javascript">
    mini.parse();
    var grid = mini.get("gridRoleApp<%== tid %>");
    var sorter = new MultiSort(grid);
    sorter.sort([{'field':''}]);

    grid.on("drawcell", function (e) {
        if (e.field=="") {
            e.cellHtml = '<a href="javascript:showRecord(\'gridRoleApp<%== tid %>\',\'<%== UI("RoleApp") %>\',650,500,\'/PartialService/formRoleApp?action=show\',[\'roleId\'])">' + e.value + '</a>';
        }
    });
</script>